home *** CD-ROM | disk | FTP | other *** search
/ Tech Arsenal 1 / Tech Arsenal (Arsenal Computer).ISO / tek-01 / addpcx.zip / VGRX.C < prev   
C/C++ Source or Header  |  1988-06-21  |  2KB  |  76 lines

  1. /*    VGRX.c   routines to make it possible to do device independant
  2.              graphics. This isn't intended to be the last word on
  3.              the subject, it's just that I've already written the
  4.              code in PCX.C, and I'd like to now use it in PCXSHOW.c,
  5.              so why not set it up as a linkable library function!?
  6. */
  7.  
  8.  
  9. #include <lib.h>
  10. #include <vgr.h>
  11.  
  12.  
  13. int    cga_init(), ega_init(), herc_init();
  14.  
  15.  
  16. int vgr_setup( specifier )
  17. char *specifier;
  18. {
  19.     vgr_type = vgr_get_board();
  20.  
  21.     if ( specifier )
  22.             if ( !strcmp(specifier, "ega") )
  23.                vgr_type = TYPE_EGA;
  24.        else if ( !strcmp(specifier, "cga") )
  25.                vgr_type = TYPE_CGA;
  26.        else if ( !strcmp(specifier, "herc") )
  27.                vgr_type = TYPE_HERC;
  28.        else if ( !strcmp(specifier, "cga2") )
  29.                vgr_type = 9;
  30.        else return ERROR;
  31.  
  32.     switch( vgr_type )
  33.     {  case TYPE_UNKNOWN:
  34.        case TYPE_MDA:
  35.           return OK;
  36.        case TYPE_CGA:
  37.           vgr_type_name = "CGA/APA2";
  38.           vgr_nit = cga_init;
  39.           vgr_md = MODE_APA2;
  40.           vgr_hres = 640;
  41.           vgr_vres = 200;
  42.           vgr_planes = 1;
  43.           break;
  44.        case 9:
  45.           vgr_type_name = "CGA/APA3";
  46.           vgr_nit = cga_init;
  47.           vgr_md = MODE_APA3;
  48.           vgr_hres = 320;
  49.           vgr_vres = 200;
  50.           vgr_planes = 1;
  51.           break;
  52.        case TYPE_EGA:
  53.           vgr_type_name = "EGA";
  54.           vgr_nit = ega_init;
  55.           vgr_md = MODE_APA0;
  56.           vgr_hres = 640;
  57.           vgr_vres = 350;
  58.           vgr_planes = 4;
  59.           break;
  60.        case TYPE_HERC:
  61.           vgr_type_name = "HERC";
  62.           vgr_nit = herc_init;
  63.           vgr_md = MODE_APA1;
  64.           vgr_hres = 720;
  65.           vgr_vres = 348;
  66.           vgr_planes = 1;
  67.           break;
  68.        default:
  69.           return ERROR;
  70.     };
  71.  
  72.     return OK;
  73. }
  74.  
  75.  
  76.